//**********************************************************************
//*
//*       Copyright 2007 - FRC Team 1675 - Ultimate Protection squad
//*
//*       Autoflex.c
//*
//*       Defines and prototypes for autoflex operation
//*
//***************************************************************
#ifndef _AUTOFLEX
#define _AUTOFLEX
#include "ifi_aliases.h"
#include "ifi_default.h"

// The length of the autonomous routine in tenths of seconds
#define TIME_LIMIT 150

// add defines here to assign commands to user controls that
// you want record/
#define  AUTO_COMMAND1 p1_x  //left Joystick x
#define  AUTO_COMMAND2 p1_y  //left Joystick y
#define  AUTO_COMMAND3 p2_y  //right joystick y
#define  AUTO_COMMAND4 p2_x  //right joystick x
//#define  AUTO_COMMAND5 
//#define  AUTO_COMMAND6 

// Number of inputs we plan to record
// Default is set up to save 4 inputs. You can save up to 6
// inputs. You can define two more auto command lines above.
// then change the number of inputs on the line below.
#define  NUM_OF_INPUTS 4  

// define the mechanism that will act as the record button. 
// In this example PWM_in5 is a pushbutton on the vex controller
// that you would press to the forward position to start recording
// For FRC you can use a PB or trigger input on a joystick port.

#define AUTO_BUTTON_REV_THRESH       (unsigned char)100 // used by VEX
#define AUTO_BUTTON_FWD_THRESH       (unsigned char)154 // used by VEX
#define AUTO_NEUTRAL_PWM_VALUE       (unsigned char)127

#define AUTO_RECORD (p1_sw_trig) //joystick1 trigger to start recording

//*************************************************************
//*    This code can be used on Vex or FRC 
//*************************************************************
#define FRC 1    //uncomment this line to run FRC controller

#ifdef FRC
#define TICKS_PER_TENTH 4  // FOR FRC 27 ms Loop
#else
#define TICKS_PER_TENTH 5  // FOR Vex 18.5 ms Loop
#endif

// if no jumper in place then write enabled (assuming jumper pulls pin lo)
#define WRITE_ENABLED (rc_dig_in01)

// The autonomous program is save in EEPROM starting at this address.
//The default is 0, the first address location in eeprom. If you are using
// other code that needs eeprom space you can change the address to the
// start of your autonomous program.
//#define START_OF_AUTO_PROGRAM 256 //use this if you are using camera code
                                    // reduces the number of inputs you can save
#define START_OF_AUTO_PROGRAM     0 // this is default


// AutoFlex function prototypes
void autoflex_playback(void); //called from User_Autonomous_Code() in user_routines_fast.c
void autoflex_recorder(void); // called from Process_Data_From_Master_uP in user_rouitnes.c
void rewind_autoflex_playback(void); // called from main in main.c
#endif
